home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc / OpenDoc Development / Debugging Support / OpenDoc Source Code / Utilities / Interfaces / Crawl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-22  |  1.4 KB  |  55 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        Crawl.h
  3.  
  4.     Contains:    StackCrawl class, for building & examining stack crawls
  5.  
  6.     Owned by:    Jens Alfke
  7.  
  8.     Copyright:    © 1995 by Apple Computer, Inc., all rights reserved.
  9.  
  10. */
  11.  
  12.  
  13. /* In StackCrawl::New, frames are numbered with 0 being the top of the stack (the caller
  14.     of New) and the numbers increasing down the stack. The endAt parameter may be negative,
  15.     which means to skip that many frames at the base of the stack; or zero, which means
  16.     to go all the way to the end. */
  17.  
  18. #ifndef __TYPES__
  19. #include <Types.h>
  20. #endif
  21.  
  22. #ifndef __STDDEF__
  23. #include <stddef.h>
  24. #endif
  25.  
  26. class StackCrawl {
  27.     public:
  28.     
  29.     static StackCrawl* New( long startAt =0, long endAt =0 );
  30.     
  31.     long        CountFrames( )                                            const
  32.                                         {return fNFrames;}
  33.     Boolean        IsFrameNative( long )                                    const;
  34.     const void*    GetFramePC( long )                                        const;
  35.     Boolean        LookupSymbol( long i, char fnName[], size_t *offset )    const;
  36.     Boolean        GetFrameName( long i, char[] )                            const;
  37.     void        AsString( char[], long maxLen, const char delimiter[] )    const;
  38.     
  39.     unsigned long Hash ( )                                                const;
  40.     
  41.     Boolean        operator== ( const StackCrawl& )                        const;
  42.     Boolean        operator!= ( const StackCrawl& c )                        const
  43.                                         {return !(*this==c);}
  44.     
  45.     private:
  46.     long  fNFrames;
  47.     const void * fFrame[1];
  48.     
  49.     StackCrawl( long nFrames )            {fNFrames = nFrames;}
  50.     void* operator new( size_t size, long nFrames );
  51. };
  52.  
  53.  
  54. Boolean    GetNameOfCaller( char str[] );
  55.